package com.sgg.gulimall_product.controller;

import com.sgg.gulimall_common.api.Result;
import com.sgg.gulimall_product.generator.domain.PmsCategory;
import com.sgg.gulimall_product.generator.service.PmsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author fileworld
 * @version 1.0
 * @create 2021/9/27 0027
 * @project base_spring_cloud
 * @description 商品三级分类表
 */
@RestController
@RequestMapping("/category")
public class CategoryController {

  @Autowired private PmsCategoryService pmsCategoryService;

  /**
   * 返回三级分类数据
   *
   * @return result
   */
  @GetMapping("/list")
  public Result listCategory() {

    List<PmsCategory> categoryList = pmsCategoryService.getCategoryList();

    return Result.success(categoryList);
  }
}
